package com.kimi.game2048

import android.content.Context
import android.view.Gravity
import android.widget.FrameLayout
import android.widget.TextView

class TileView(context: Context) : FrameLayout(context) {
    private val textView: TextView

    init {
        textView = TextView(context)
        textView.gravity = Gravity.CENTER
        addView(textView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
    }

    fun setValue(value: Int) {
        textView.text = if (value != 0) value.toString() else ""
    }
}
